//
//  ZZSelectorCell.m
//  RecorderTest
//
//  Created by 张彦东 on 2017/5/24.
//  Copyright © 2017年 Z. All rights reserved.
//

#import "ZZSelectorCell.h"

@interface ZZSelectorCell ()

@property (nonatomic, weak) UILabel *selectLabel;
@property (nonatomic, weak) UIView *lineView;

@end

@implementation ZZSelectorCell

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    NSString *cellName = NSStringFromClass([self class]);
    [tableView registerClass:[self class] forCellReuseIdentifier:cellName];
    return [tableView dequeueReusableCellWithIdentifier:cellName];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor whiteColor];
        [self setupView];
    }
    return self;
}

- (void)setupView {
    UILabel *label = [[UILabel alloc] init];
    [self addSubview:label];
    _selectLabel = label;
    label.font = [UIFont systemFontOfSize:14];
    label.textColor = [UIColor lightGrayColor];
    label.textAlignment = NSTextAlignmentCenter;
    
    UIView *view = [[UIView alloc] init];
    [self addSubview:view];
    _lineView = view;
    view.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.7];
}

- (void)setSelectLabelText:(NSString *)selectLabelText  {
    _selectLabelText = selectLabelText;
    _selectLabel.text = selectLabelText;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    _selectLabel.frame = self.bounds;
    _lineView.frame = CGRectMake(30, CGRectGetHeight(self.frame) - 1, CGRectGetWidth(self.frame) - 60, 1);
}

@end
